package com.goods.business.converter;

import com.goods.common.model.business.OutStock;
import com.goods.common.model.system.Menu;
import com.goods.common.vo.business.OutStockVO;
import com.goods.common.vo.system.MenuNodeVO;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class OutStockConverter {

    public static List<OutStockVO> converterToOutStocks(List<OutStock> outStockList){
        //先过滤出用户的菜单
        List<OutStockVO> outStockVOList=new ArrayList<>();
        if(!CollectionUtils.isEmpty(outStockList)){
            for (OutStock outStock : outStockList) {
                OutStockVO outStockVO = new OutStockVO();
                BeanUtils.copyProperties(outStock,outStockVO);
                outStockVOList.add(outStockVO);
            }
        }
        return outStockVOList;
    }


    public static OutStockVO converterToStock(OutStock outStock){
        OutStockVO outStockVO = new OutStockVO();
        BeanUtils.copyProperties(outStock,outStockVO);
        return outStockVO;
    }

    public static OutStock converterToStockVo(OutStockVO outStockVO){
        OutStock outStock = new OutStock();
        BeanUtils.copyProperties(outStockVO,outStock);
        return outStock;
    }
}
